<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../lib/vue-2.4.0.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input type="button" value="浪起来" @click="lang">
        <input type="button" value="低调" @click="stop">
        <h3>{{msg}}</h3>
    </div>
    <script>
    var vm = new Vue({
        el: '#app',
        data: {
              msg: '猥琐发育，别浪。' ,
              id: null
        },
        methods: {
            lang() {
                if(this.id != null){
                    return;
                }
                this.id = setInterval(() => {
                    var start = this.msg.substring(0,1);
                    var end = this.msg.substring(1);
                    this.msg = end + start;
                },400);
                var start = this.msg.substring(0,1);
                    var end = this.msg.substring(1);
                    this.msg = start + end;
                    console.info(start);
                    console.info(end);
                    console.info(end + start)
                console.info("lang")
            },
            stop() {
                clearInterval(this.id);
                this.id = null;
            }
        }
    });
    </script>
</body>
</html>